package com.tledu.zyf.servlet.group;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.tledu.zyf.model.Group;
import com.tledu.zyf.util.ForwardUtil;
import com.tledu.zyf.util.ObjectFactory;

@WebServlet("/group/vagueGroupname")
public class GroupVagueGroupnameServlet extends HttpServlet {
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// 获取传递的数据
		String groupname = request.getParameter("groupname");
		// 调用 vagueUsername 方法 , 获取所有的用户数据
		List<Group> groups = ObjectFactory.getGroupService().vagueUsername(groupname);
//		for (User user2 : users) {
//			System.out.println(user2);
//		}
		// 传递到页面
		request.setAttribute("groups", groups);

		// 跳转到对应的展示页面
		ForwardUtil.forward(request, response, "group/list");
	}
}
